<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <script src="/static/js/jquery-3.2.1.min.js"></script>
    <script src="/static/js/jquery-3.2.1.min.js"></script>
    <!-- Site CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<form method="post" action="" class="panel-body wrapper-lg">
    <label for="password">原始密码：</label>
    <input type="password" name="password" id="password"></br></br>
    <label for="update_password">新密码：</label>
    <input type="password" name="update_password" id="update_password"></br></br>
    <label for="repeat_password">重复密码：</label>
    <input type="password" name="repeat_password" id="repeat_password"></br></br>
    <input type="button" name="button" id="pass-btn" value="修改密码">
</form>
<script type="text/javascript">
    $("#pass-btn").click(function() {
        var password = $("#password").val();
        var update_password = $("#update_password").val();
        var repeat_password = $("#repeat_password").val();

        if (password == '' || update_password == '' || repeat_password =='')
        {
            alert('password or update_password or repeat_password error');
            return false;
        }

        $.ajax({
            url: "{:url('backend/Account/updatePass')}",
            method: "POST",
            data: {"password": password, "update_password": update_password, "repeat_password": repeat_password},
            dataType: "json",
            success: function(res) {
                if (res.status === 1)
                {
                    window.location.href = "{:url('backend/Account/login')}";
                }
                else
                {
                    alert(res.msg);
                }
            }
        })
    });
</script>
</body>
</html>